# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

C = add.c boot.c create.c destroy.c gpt.c label.c linux_port.c \
    map.c recover.c remove.c show.c
H = gpt.h linux_port.h map.h sys_endian.h sys_gpt.h sys_uuid.h

CFLAGS ?= -Wall -m32
HOSTCC ?= gcc
HOSTCFLAGS ?= -Wall -m32

all: gpt

gpt: $(C) $(H) Makefile
	$(CC) -o gpt $(CFLAGS) $(C) \
          -D_BSD_SOURCE -DLINUX -D_FILE_OFFSET_BITS=64 -luuid

# A gpt binary to run on the host. We statically link libuuid here
# to reduce the need for a 32-bit libuuid on the host machine.
gpt-host: $(C) $(H) Makefile
	$(HOSTCC) -o gpt-host $(HOSTCFLAGS) $(C) \
          -D_BSD_SOURCE -DLINUX -D_FILE_OFFSET_BITS=64 \
	  -Wl,-Bstatic -luuid -Wl,-Bdynamic

clean:
	rm -f gpt gpt-host *.o *~
